import _axios from '@/tool/http.js'

// 获取预约客户的列表
export const getPendingOrders = (obj) => {
    let options = {
        url: api.crm + '/reservationInfo/list',
        method: 'POST',
        data: JSON.stringify(obj),
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 货物预约来源
export const getResource = () => {
    let options = {
        url: api.base + '/systemDictionary/getByType/reservationSource',
        method: 'POST',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options);
}
// 创建预约
export const createOrder = (param) => {
    let options = {
        url: api.crm + '/reservationInfo/add',
        // url: 'api/reservationInfo/add',
        method: 'POST',
        data: JSON.stringify(param),
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 所有客服
export const getFollowUpList = () => {
    let options = {
        url: api.base + '/systemUser/get',
        method: 'POST',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        },
        data: JSON.stringify({})
    }
    return _axios(options)
}
export const findStaffByName = (name) => {
    let options = {
        url: api.base + '/systemUser/get',
        method: 'POST',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        },
        data: JSON.stringify({
            userName: name
        })
    }
    return _axios(options)
}
// 获取客服信息
export const getStaffInfo = (id) => {
    let options = {
        url: api.crm + '/reservationInfo/getSupportStaff?parentId=' + id,
        method: 'GET',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 编辑预约
export const modifyOrder = (param) => {
    let options = {
        url: api.crm + '/reservationInfo/edit',
        method: 'POST',
        data: JSON.stringify(param),
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 审核预约
export const verifyOrder = (param) => {
    let options = {
        url: api.crm + '/reservationInfo/check',
        method: 'POST',
        data: JSON.stringify(param),
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 点击审核时验证
export const editCheck = (id) => {
    let options = {
        url: api.crm + '/reservationInfo/editCheck/' + id,
        method: 'GET',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 审核页面取消时
export const cancleCheck = (id) => {
    let options = {
        url: api.crm + '/reservationInfo/cancleCheck/' + id,
        method: 'GET',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 获取每种情况的数量
export const getCount = () => {
    let options = {
        url: api.crm + '/reservationInfo/getCount',
        method: 'GET',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 指派
export const doDistribute = (param) => {
    let options = {
        url: api.crm + '/reservationAssign/assign',
        method: 'POST',
        data: JSON.stringify(param),
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 编辑获取指派的人
export const getDistribute = (id) => {
    let options = {
        url: api.crm + '/reservationAssign/getAssignUser/' + id,
        method: 'GET',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 获取预约审批失败原因
export const getFaildReason = () => {
    let options = {
        url: api.base + '/systemDictionary/getByType/failedType',
        method: 'POST',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}
// 获取预约审批失败原因
export const getWastedReason = () => {
    let options = {
        url: api.base + '/systemDictionary/getByType/disabledType',
        method: 'POST',
        headers: {
            "Content-Type": 'application/json', "Accept": 'application/json'
        }
    }
    return _axios(options)
}